<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>location地址栏对象</title>
    <style>
        p{
            text-align: center;
        }
        span{
            color: red;
        }
    </style>
    <script>
       
            // 定义方法，改变秒数，跳转页面
             num = 5;
            // 倒计时操作
            function showTime(){
                num --;
                
                // 判断跳转
                if(num <= 0){
                    // 跳转首页
                    // window.location.href
                    location.href = "index.html";
                }
                
                document.getElementById("time").innerText = num;
                
            }
            // 设置定时循环
            setInterval("showTime()",1000);
        
    </script>
</head>
<body>
    <p>
        注册成功！<span id="time">5</span>秒之后自动跳转到首页...
    </p>
</body>
</html>